package com.shpng.cheapenglish.action.nouse;

import java.io.IOException;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Set;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.shpng.cheapenglish.db.User;
import com.shpng.cheapenglish.db.UserWord;
import com.shpng.cheapenglish.db.Word;
import com.shpng.cheapenglish.manager.UserManager;
import com.shpng.cheapenglish.manager.WordManager;

public class VerifyMyWordAction {

//	public String execute(HttpServletRequest req, HttpServletResponse resp)
//			throws ServletException, IOException {
//		WordManager wordManager = WordManager.getInstance();
//		UserManager userManager = UserManager.getInstance();
//		User user = userManager.getUser((String) req.getSession().getAttribute(
//				"email"));
//		List<UserWord> userWords = wordManager.getUserWords(user);
//		Iterator<UserWord> iterator = userWords.iterator();
//		Set<Long> wordIds = new HashSet<Long>();
//		while (iterator.hasNext()) {
//			UserWord uw = iterator.next();
//			Word word = wordManager.getWord(uw.getWordId());
//			if (word == null) {
//				wordManager.deleteUserWord(uw);
//				continue;
//			}
//			if (wordIds.contains(uw.getWordId())) {
//				wordManager.deleteUserWord(uw);
//				continue;
//			} else {
//				wordIds.add(uw.getWordId());
//			}
//
//		}
//		return "/pages/word-input.jsp";
//	}
}
